| Conditions | 2 |
| Total Lines | 24 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Inject } from '@nestjs/common'; |
||
| 14 | |||
| 15 | public async execute( |
||
| 16 | query: GetContactsQuery |
||
| 17 | ): Promise<Pagination<ContactView>> { |
||
| 18 | const contactsView: ContactView[] = []; |
||
| 19 | const [contacts, total] = await this.contactRepository.findContacts( |
||
| 20 | query.page |
||
| 21 | ); |
||
| 22 | |||
| 23 | for (const contact of contacts) { |
||
| 24 | contactsView.push( |
||
| 25 | new ContactView( |
||
| 26 | contact.getId(), |
||
| 27 | contact.getFirstName(), |
||
| 28 | contact.getLastName(), |
||
| 29 | contact.getCompany(), |
||
| 30 | contact.getEmail(), |
||
| 31 | contact.getPhoneNumber(), |
||
| 32 | contact.getNotes() |
||
| 33 | ) |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | |||
| 37 | return new Pagination<ContactView>(contactsView, total); |
||
| 38 | } |
||
| 40 |